import React from 'react'
import Taro from '@tarojs/taro'
import {View,Text} from '@tarojs/components'
import {Icon} from '@/components/Icon'
import './index.scss'

interface AddressProps{
    address:any
}

export default (props:AddressProps)=>{
  const {address}=props;

  const toDetail = (item) => {
    Taro.navigateTo({
      url: `/pages/me/applyDetail/index?query=${JSON.stringify(item)}`,
      events: {
        // 传递参数
        'TO_APPLY_DETAIL_EVENT': (data) => console.log(data),
      },
    });
  }


  return(
    <View className='xxm-address-com-address' onClick={() => toDetail(address)}>
      <View className='left'>
        <View className='top'>
          活动名称:
          <Text className='name' style={{marginLeft: 12}}>
            {address?.activity?.name}
          </Text>
          <View>
            姓名:
            <Text className='phone' style={{marginLeft: 12}}>
              {address.registerName}
            </Text>
          </View>
        </View>
        <View className='bottom' style={{textAlign: 'right'}}>
          {address?.order?.status === 'PAY' ? (
            <Text className='default' style={{color: 'darkgreen'}}>
              [支付成功]
            </Text>
          ) : (
            <Text className='default' style={{color: 'red'}}>
              [未支付]
            </Text>
          )}
          {/*<Text className='address'>*/}
          {/*  /!* {address.address_detail} *!/*/}
          {/*  {address.address_name}*/}
          {/*  {address.address_description}*/}
          {/*</Text>*/}
        </View>
      </View>
      <View className='right'>

        <Icon name='arrow-right' size={14} color='#B2B2B2' />
      </View>
    </View>
  )
}
